<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        window.onload = function () {
            var oBox = document.getElementById('box');
            var iLeft = 0;

            var timer = setInterval(fnMove, 30);

            function fnMove() {
                iLeft += 3;
                if(iLeft >600){
                    clearInterval(timer)
                }
                oBox.style.left = iLeft + 'px';
            }
            // fnMove();

        }
    </script>

    <style>
        .box{
            width: 200px;
            height: 200px;
            background: red;
            position: fixed;
            top: 100px;
            left: 0;
        }
    </style>
</head>
<body>
    <div class="box" id="box"></div>
</body>
</html>